﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml;
using System.IO;
using System.Diagnostics;
using System.Xml.Serialization;
using System.Data.Design;
using System.CodeDom.Compiler;
using Microsoft.CSharp;
using Microsoft.VisualBasic;
using Microsoft.JScript;
using System.CodeDom;
using TDS = System.Data.Design.TypedDataSetGenerator;

namespace System.Data.DataSetGenerator
{
    /// <summary>
    /// Provides a description for the typed DataSet
    /// </summary>
    [Serializable]
    [XmlType(TypeName = "DataSet")]
    public class DataSetDescriptor
    {

        public DataSetDescriptor()
        {
            Util.InitializeObject(this);
        }

        private TableCollection tables;

        public TableCollection Tables
        {
            get
            {
                if (tables == null)
                    tables = new TableCollection();
                return tables;
            }
        }


        private RelationCollection relations;

        /// <summary>
        /// Collection of the DataSet relations
        /// </summary>
        public RelationCollection Relations
        {
            get
            {
                if (relations == null)
                    relations = new RelationCollection();
                return relations;
            }
        }


        /// <summary>
        /// Gets or sets the namespace of the generated class
        /// </summary>
        [XmlAttribute]
        [DefaultValue("")]
        public String Namespace { get; set; }

        /// <summary>
        /// Gets or sets the name of the generated dataset
        /// </summary>
        [XmlAttribute]
        [DefaultValue("")]
        public String DataSetName { get; set; }

        /// <summary>
        /// Provides whether to generate the xsd file for the DataSet
        /// </summary>
        [XmlAttribute]
        [DefaultValue(true)]
        public bool GenerateXsd { get; set; }

        /// <summary>
        /// Gets or sets the file name for the XSD file
        /// </summary>
        [XmlAttribute]
        [DefaultValue("")]
        public String OutputXsdFileName { get; set; }

        /// <summary>
        /// Provides whether to generate the code file for the typed DataSet
        /// </summary>
        [XmlAttribute]
        [DefaultValue(true)]
        public bool GenerateCode { get; set; }


        /// <summary>
        /// Gets or sets the file name for the code file
        /// </summary>
        [XmlAttribute]
        [DefaultValue("")]
        public String OutputCodeFileName { get; set; }

        /// <summary>
        /// Gets or sets a value that indicates whether the code generator should generate unique indexes 
        /// for the datatables columns
        /// </summary>
        [XmlAttribute]
        [DefaultValue(false)]
        public bool IgnoreIndexes { get; set; }

        /// <summary>
        /// Gets or sets a value that indicates whether the code generator should generate foreign key constraints
        /// </summary>
        [XmlAttribute]
        [DefaultValue(false)]
        public bool IgnoreForeignKeys { get; set; }
    }
}
